clc;clear;clearvars;
addpath('CEC2008\');
global initial_flag
initial_flag = 0;

% 初始化变量维度,种群数,最大迭代次数,搜索区间,F,CR
dim = 30;
popsize = 100;
maxIteration = 1000;
LB = -100 * ones(1, dim);
UB = 100 * ones(1, dim);
F = 1;
CR = 0.9;

[globalBest, globalBestFitness, FitnessHistory] = DE(popsize, maxIteration,dim, LB, UB, F, CR,  @(x)benchmark_func(x,1));
[globalBest1, globalBestFitness1, FitnessHistory1] = JADE(popsize, maxIteration,dim, LB, UB, @(x)benchmark_func(x,1));
[globalBest2, globalBestFitness2, FitnessHistory2] = SaNSDE(popsize, maxIteration,dim, LB, UB, @(x)benchmark_func(x,1));
plot(FitnessHistory);
hold on;
plot(FitnessHistory1);
hold on;
plot(FitnessHistory2);
legend('DE','JADE','SaNSDE','Location', 'northeast');
